/*
var frm = new qinglan.Canvas.Frame('canvas');

var imgsrc = 'img/hakurei_action.png';
var imageNode = new Image();

var imgSprite = new qinglan.Canvas.Sprite('img', new qinglan.Canvas.Vector2(10, 10), { zIndex : 1, velocity : new qinglan.Canvas.Vector2(1, 1)});
imgSprite.frameCount = 0;
imgSprite.split = Math.floor(frm.Frames / 7);
imgSprite.warp = 32;
imgSprite.offset = 0;
imgSprite.img = imageNode;

imgSprite.update = function(ctx) {
    imgSprite.frameCount++;
    var mod = Math.floor(imgSprite.frameCount / imgSprite.split);
    if (mod > 6) {
        imgSprite.frameCount = 0;
        mod = 0;
    }
    imgSprite.offset = imgSprite.warp * mod;
    imgSprite.offset >= 250 && (imgSprite.offset = 250 - 32);
    //console.log(imgSprite.frameCount + '   ' +mod+'   '+imgSprite.offset);
    //this.position = this.position.add(this.velocity);
};
imgSprite.draw = function(ctx) {
    ctx.drawImage(this.img, imgSprite.offset, 47 * 2, 33, 47, this.position.x, this.position.y, 33, 47);
    //ctx.drawImage(this.img,224,0,33,47,this.position.x,this.position.y,33,47);
};

frm.addSprite(imgSprite);

imageNode.onload = function() {
   // frm.star();
};

imageNode.src = imgsrc;


*/
var Person = qinglan.Canvas.Class({
    initialize: function(name,age) {
        this.name = name;
        this.age = age;
        this.say();
    },
    say: function() {
        console.log(this.name);
    }
});
var superMan = Person.extend({
    initialize: function(name) {
        this.supr(name);
        this.say();
    },
    fly: function() {
        console.log('flying');
    },
    say: function() {
        this.supr();
        console.log('a'+this.name);
    }
});
var ssMan = superMan.extend(function(name,age,opt){
    this.opt = opt;
    this.say();
}).methods({
    fight: function() {
        console.log('fight')
    }
})

// 方式二
var animal = qinglan.Canvas.Class(function(kind) {
    this.kind = kind;
}).statics({
    head: 1,
    feet: 4
}).methods({
    say: function() {
        console.log(this.head);
    }
});



